<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            /* 设置div的宽高使其大于图片的大小 */
            width: 400px;
            height: 100px;
            border: 1px solid #ff0000;
            /* 设置一个背景图片 */
            background-image: url("./log50.png");
            /* 不重复 */
            background-repeat: no-repeat;
        }

        .div1 {
            /* 长75px 宽75px */
            background-size: 75px 75px;
        }

        .div2 {
            /* 长20% 宽50% */
            background-size: 20% 50%;
        }

        .div3 {
            /* 自动的合适大小： */
            background-size: cover;
        }

        .div4 {
            /* 自动的合适大小 */
            background-size: contain;
        }
    </style>
</head>
<body>
    <p>background-size: 75px 75px;</p>
    <div class="div1"></div>
    <p>background-size: 20% 50%;</p>
    <div class="div2"></div>
    <p>background-size: cover;</p>
    <div class="div3"></div>
    <p>background-size: contain;</p>
    <div class="div4"></div>
</body>
</html>